package org.fall.view.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.fall.view.model.po.DailyNewspaperPO;
import org.fall.view.model.vo.DailyNewspaperVO;

import java.util.List;

/**
 * @author sprogFall
 * @since 2021/4/12 17:03
 */
@Mapper
public interface DailyNewspaperMapper extends BaseMapper<DailyNewspaperPO> {
    /**
     * 将抄送人信息插入中间表中
     * @param paperId 日报id
     * @param leaderId leaderId
     */
    @Insert("insert into newspaper_leader_table(newspaper_id, leader_id) VALUE(#{paperId}, #{leaderId})")
    void insertCopyForInfo(@Param("paperId") Integer paperId, @Param("leaderId") Integer leaderId);

    /**
     * 根据作者id得到他书写的日报信息
     * @param writerId 作者id
     * @return 日报VO list
     */
    List<DailyNewspaperVO> getDailyNewsPaperInfoByWriterId(@Param("writerId") Integer writerId);

    /**
     * 根据抄送人id得到抄送得到的日报信息
     * @param leaderId 抄送人id
     * @return 日报VO list
     */
    List<DailyNewspaperVO> getDailyNewspaperInfoByLeaderId(@Param("leaderId") Integer leaderId);
}
